unit Unit2;

interface
uses
  Classes,Dialogs,Class_TaskDetail,SysUtils,ADODB;
type
  TWorkThread=class(TThread)
  private
    Pos:Integer;
  public
    FTaskDetail:TTaskDetail;

  protected
    procedure Update;
    procedure Execute; override;
  end;

implementation
uses
  Unit3;

{ TWorkThead }

procedure TWorkThread.Execute;

var
  i:integer;
  //J:Integer;
begin
  {For   i:=0   to   100   do
  begin
    //Do   what   u   want...

    //for J:=0 to 10000000 do ;
    FTaskDetail.TestSave;
    pos:=i;
    Synchronize(Update);
  end;  }
  //FTaskDetail.TestSave;
  for i:=0 to FTaskDetail.TestCount-1 do
  begin
    FTaskDetail.Code:='TESTDetail'+IntToStr(I);
    FTaskDetail.InsertDB(nil);
    Pos:= I div (FTaskDetail.TestCount div 100);

    Synchronize(Update);
  end;


 { for i:=0 to 100 do
  begin
    Pos:=I;
    Synchronize(Update);
  end;     }
end;


procedure TWorkThread.Update;
begin
   Form3.SetProgressBarPosition(pos);
end;

end.
 